//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#if _MSC_VER > 1000
#pragma once
#endif

#if !defined(__CCONDITION_H__)
#define __CCONDITION_H__

class CCondition : public ICondition
{
// Interface functions
//
public:
    CARAPI_(PInterface) Probe(
        /* [in] */ REIID riid);

    CARAPI_(UInt32) AddRef(void);

    CARAPI_(UInt32) Release(void);

    CARAPI Aggregate(
        /* [in] */ AggrType aggrType,
        /* [in] */ PInterface pObject);

    CARAPI GetDomain(
        /* [out] */ PInterface *pObject);

    CARAPI Wait(
        /* [in] */ IMutex * pMutex,
        /* [out] */ WaitResult *pResult);

    CARAPI TryWait(
        /* [in] */ IMutex * pMutex,
        /* [in] */ Millisecond32 msTimeout,
        /* [out] */ WaitResult *pResult);

    CARAPI Pulse();

    CARAPI PulseAll();

    virtual ~CCondition() {}
private:
    Interlocked m_cRef;
    DzCondition m_kcondition;
};

#endif //!(__CCONDITION_H__)
